import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../resource/ImagesConst";
import { BaseItem } from "../common/BaseItem";
import { ObjCreate } from "../common/ObjCreate";
import { ItemData } from "../../resource/info/ItemData";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class HuntRewardBoxItem
    
    export  class HuntRewardBoxItem extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._bg = ResouceConst.getScaleBitmap(ImagesConst.WardrobeBoeder);
            this._bg.setSize(88, 107);
            addChild(this._bg);
            this._itemBorder = ResouceConst.getScaleBitmap(ImagesConst.PackItemBg);
            this._itemBorder.setSize(66, 66);
            this._itemBorder.x = (width - this._itemBorder.width) / 2;
            this._itemBorder.y = 12;
            addChild(this._itemBorder);
            this._item = new BaseItem();
            this._item.x = this._itemBorder.x + 3;
            this._item.y = this._itemBorder.y + 3;
            this._item.setSize(60, 60);
            addChild(this._item);
            this._textBg = ObjCreate.createBg(0, 82, 88, 22, this, ImagesConst.FightingStrgBg);
            this._itemText = ObjCreate.createTextField("", 1, 83, 86, 20, this);
            this._infoText = ObjCreate.createTextField("", 1, 109, 86, 20, this);
            this._itemText.autoSize = flash.text.TextFormatAlign.CENTER;
            this._infoText.autoSize = flash.text.TextFormatAlign.CENTER;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            if (arg1) 
            {
                this.updateData(arg1.itemId, arg1.text);
            }
            else 
            {
                this.updateData(0, "");
            }
            return;
        }

        /* internal  */updateData(arg1: int, arg2: string): void
        {
            this._itemData = new ItemData(arg1);
            this._item.itemData = this._itemData;
            this._itemText.htmlText = this._itemData.htmlName;
            this._infoText.htmlText = HTMLUtil.addColor(arg2, "#00ff00");
            return;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_itemBorder: ScaleBitmap;

        /* internal */ /* var */_item: BaseItem;

        /* internal */ /* var */_textBg: ScaleBitmap;

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_infoText: Object /* flash.text.TextField */;

        /* internal */ /* var */_itemText: Object /* flash.text.TextField */;
    }
